<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	
	<xsl:include href="../admin.xsl" />
	<xsl:include href="../cp/path.xsl" />
	
	<!-- Запускаем рендер страницы -->
	<xsl:template match="/data">
		<html>
		
		<head>
			<title>
				<xsl:value-of select="$pageTitle" />
			</title>
			<xsl:call-template name="meta-head" />
			<script type="text/javascript" src="{$baseURI}/js/admin/filemanager.js" />
			<link rel="stylesheet" href="{$baseURI}/css/admin/filemanager.css" type="text/css" media="all" />
		</head>
		<body>
			<xsl:call-template name="admin-header" />
			
			<div id="blocks">
				<div id="blocks_inner">
					<form action="{$baseURI}/admin/filemanager/js_action" target="backframe" method="post" enctype="multipart/form-data">
						<input type="hidden" name="parent_folder" class="parent_folder" value="" />
						<input type="hidden" name="folder" class="current_folder" value="" />
						
						<div class="block">
							<h3>Загрузка файлов</h3>
							<div class="body">
								<div id="files_upload_fields">
									<p>
										<input type="file" name="upload[]" />
										<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
										<input type="button" value="+" onclick="addFileUpload(this);" />
									</p>
								</div>
								<p>
									<input type="submit" name="button_upload" value="Загрузить" />
								</p>
							</div>
						</div>
						<div class="block">
							<h3>Распаковка zip-архива</h3>
							<div class="body">
								<input id="zip_upload_field" type="file" name="zip" />
								<p>
									<input type="submit" name="button_zip" value="Распаковать" />
								</p>
							</div>
						</div>
						<div class="block">
							<h3>Новая папка</h3>
							<div class="body">
								<input type="text" name="folder_name" id="new_folder_name_field" value="" style="width:100%" />
								<p>
									<input type="submit" name="button_new_folder" value="Создать" />
								</p>
							</div>
						</div>
					</form>
				</div>
			</div>
			
			<div id="content">
				<div id="content_inner">
					<xsl:apply-templates select="response" />
				</div>
			</div>
			
			<xsl:call-template name="footer" />
			
			<iframe name="backframe" style="display:none" src="about:blank" width="1" height="1"></iframe>
		</body>
		</html>
	</xsl:template>
	
	<xsl:template match="response">
		<div id="path">
			<xsl:apply-templates select="document('xmodule://cp/getPath/0;filemanager')/data/response" mode="cp-path" />
		</div>
		
		<h1>Менеджер файлов</h1>
		
		<xsl:apply-templates select="error" />
		<xsl:apply-templates select="message" />
		
		<div id="filemanager_messages" />
		
		<form action="{$baseURI}/admin/filemanager/js_action" target="backframe" method="post" enctype="multipart/form-data">
			<input type="hidden" name="parent_folder" class="parent_folder" value="" />
			<input type="hidden" name="folder" class="current_folder" value="" />
			
			<div id="folder_path_wrapper">
				<div id="folder_path" />
				<div class="refresh">
					<a title="Обновить" href="#" onclick="loadFolder(); return false;">
						<img src="{$baseURI}/images/filemanager/refresh.png" />
					</a>
				</div>
			</div>
			
			<table class="standart filemanager canHightlightRows" cellspacing="0" cellpadding="0">
				<thead>
					<tr>
						<th><input type="checkbox" onchange="selectAllRows();" class="checkboxForAll" /></th>
						<th>Имя</th>
						<th>Размер</th>
						<th>Дата изменения</th>
						<th>Права</th>
						<th>Опции</th>
					</tr>
				</thead>
				
				<tbody id="filemanager_wrapper" />
			</table>
			
			<p>
				<input type="submit" name="button_delete" value="Удалить выбранные" />
			</p>
		</form>
	</xsl:template>
	
</xsl:stylesheet>